package com.navinfo.platform.aero.data.rest.core.dto;

import com.navinfo.platform.aero.data.rest.core.enumref.ResultCode;

import java.io.Serializable;

/**
 * @author zhangdong
 * @date 2017/12/27
 */
public class CommandResult implements Serializable {
    private int resultCode;
    private String message;
    private Object data;

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public CommandResult() {
    }

    public CommandResult(Integer resultCode, String message) {
        this.resultCode = resultCode.intValue();
        this.message = message;
    }

    public <T extends CommandResult> T fillResult(ResultCode result) {
        this.setResultCode(result.code());
        this.setMessage(result.result());
        return (T) this;
    }

    public int getResultCode() {
        return this.resultCode;
    }

    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

}
